package com.smartwebx.fr.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.smartwebx.fr.bean.SimpleUseArgConf;
import com.smartwebx.fr.service.StoredProcService;
import com.smartwebx.fr.service.ckeditor.UseArgConfService;

@Controller
@RequestMapping("/simpleData")
public class SimpleDataController {

	@Autowired
	private StoredProcService storedProcService;
	@Autowired
	private UseArgConfService useArgConfService;

	/**
	 * produces 防止返回单个字符串中文乱码
	 * 
	 * @param pageId
	 * @param code
	 * @param backType
	 * @return
	 * @throws Exception 
	 */
	@RequestMapping(value = "/getSimpleData", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String getSimpleData(Integer pageId, String code) throws Exception {
		List<SimpleUseArgConf> simUseArgs = useArgConfService.getSimpleUseArgConfs(pageId);
		String dataPoint = storedProcService.getSingleData(code, simUseArgs,
				"signValue");
		return dataPoint;
	}
}